#ifndef CTP_MARKET_DATA_LINK_H_
#define CTP_MARKET_DATA_LINK_H_

#include "ThostFtdcMdApi.h"
#include "CtpLinkBase.h"
#include "marketdatalink.h"
#include "AdaptorDlgBase.h"

class CtpMarketDataLink :
	public CThostFtdcMdSpi, public CtpLinkBase, public MarketDataLink
{
public:
	CtpMarketDataLink(const string &name, CThostFtdcMdApi *api);
	~CtpMarketDataLink();

	//Override
	virtual void Connect();
	virtual void Disconnect();

	virtual void OnRspUserLogout(CThostFtdcUserLogoutField *userLogout, 
	CThostFtdcRspInfoField *rspInfo, int requestID, bool isLast);

	virtual void OnFrontConnected();
	virtual void OnFrontDisconnected();
	virtual void OnRspUserLogin(CThostFtdcRspUserLoginField *rspLogin,
		CThostFtdcRspInfoField *rspInfo, int reqID, bool isLast);
	virtual void OnRtnDepthMarketData(CThostFtdcDepthMarketDataField *field);
	virtual void OnRspError(CThostFtdcRspInfoField *rspInfo, int requestID, bool isLast);

protected:
	CThostFtdcMdApi			*mMdApi;
	bool					mDisplayMarketData;
	int						mRequestID;
};

#endif